<template>
  <div class="home">
    <router-view v-slot="{ Component }">
      <keep-alive include="consultation">
        <component :is="Component" />
      </keep-alive>
    </router-view>

    <tabbar :user="tabbar" />
  </div>
</template>

<script>
import tabbar from "@/components/tabbar/tabbar.vue";
export default {
  name: "home",
  components: { tabbar },
  data() {
    return {
      tabbar: [],
    };
  },
  created() {
    // const result = await MJCrequesting.request({
    //   url: "/allcomments",
    //   methods: "GET",
    // });
    let patient = [
      { tips: "首页", url: "home/index" },
      { tips: "问诊", url: "home/consultation" },
      { tips: "取药", url: "home/medicine" },
      { tips: "个人", url: "home/patientmyself" },
    ];
    let doctor = [
      { tips: "首页", url: "home/index" },
      { tips: "接诊", url: "home/receivePatient" },
      { tips: "病人", url: "home/patient" },
      { tips: "个人", url: "home/doctormyself" },
    ];
    let user_type = this.$store.state.user_type;
    this.tabbar = user_type == 1 ? doctor : patient;
  },
};
</script>

<style lang="scss" scope>
a {
  text-decoration: none;
  color: #333;
  display: block;
  flex: 1;
}
.home {
  width: 100%;
  height: 100%;
  font-size: 18px;
}
</style>
